<template>
  <div class="choice-list">
    <div
      class="choice-list-item"
      v-for="v in isChooseList"
      :key="'isApply_' + v.order_id"
      @click="jumpTo(v.id)"
    >
      <div class="top-wrap clearfix">
        <div class="logo">
          <img :src="v.images" />
        </div>
        <div class="text-wrap">
          <p class="name-wrap">
            <span class="title" :title="v.name">{{ v.name }}</span>
            <span class="corner" :class="[v.type === 0 ? 'online' : 'offline']">
              {{ v.type === 0 ? '线上专场' : '线下专场' }}
            </span>
          </p>
          <p class="pro">主办单位：{{ v.for_name }}</p>
          <div class="icon-wrap">
            <span class="time">
              <i class="iconfont icon-time"></i>
              <span>双选会时间：{{ v.start_time }} - {{ v.end_time }}</span>
            </span>
            <span class="address">
              <i class="iconfont icon-map"></i>
              <span v-if="v.type === 0">线上</span>
              <span v-else>{{ v.address }}</span>
            </span>
          </div>
        </div>
        <div class="company-data">
          <div class="data">
            <p class="num">{{ v.attend_company }}</p>
            <p class="text">参会单位</p>
          </div>
          <div class="data">
            <p class="num">{{ v.operating_number }}</p>
            <p class="text">提供岗位</p>
          </div>
        </div>
        <div class="btn-wrap">
          <button
            :class="[
              v.status === 0 || v.status === 1 || v.status === 2
                ? 'confirm'
                : 'detail',
            ]"
            type="button"
            @click.stop="submit(v)"
          >
            {{ v.statusText }}
          </button>
        </div>
      </div>
      <div class="state">
        <p>{{ v.statusText }}</p>
      </div>
    </div>
  </div>
</template>

<script>

export default {
  props: ['list'],
  data () {
    return {
      online: null,
      isChooseList: [],
    }
  },
  watch: {
    list (val) {
      this.isChooseList = val;
    }
  },
  created () {
    this.isChooseList = this.list
  },
  mounted () {
  },
  computed: {

  },
  methods: {
    jumpTo (id) {
      this.$router.push({
        path: '/choice/detail',
        query: {id}
      })
    },
    submit (obj) {
      this.$router.push({
        path: '/order',
      })
    },
  },
}
</script>

<style lang="scss" scoped>
.choice-list {
  position: relative;
  margin-bottom: 50px;
  .detail-title {
    margin-bottom: 20px;
  }
  .choice-list-item {
    position: relative;
    min-height: 170px;
    width: $base-width;
    padding: 0 30px;
    margin-bottom: 10px;
    border: 1px solid #ebebeb;
    &:hover {
      cursor: pointer;
      background: #f6f6f6;
    }
    .top-wrap {
      min-height: 120px;
    }
    .logo {
      float: left;
      margin-top: 23px;
      height: 74px;
      width: 74px;
      overflow: hidden;
      background: #fff;
      text-align: center;
      font-size: 0;
      border: 1px solid #ebebeb;
      img {
        height: 100%;
      }
    }
    .text-wrap {
      float: left;
      width: 680px;
      margin: 23px 0 0 20px;
      position: relative;
      .name-wrap {
        line-height: 24px;
        .title {
          width: 580px;
          font-size: 18px;
          color: #24292f;
          display: -webkit-box;
          -webkit-box-orient: vertical;
          -webkit-line-clamp: 2;
          overflow: hidden;
        }
        .corner {
          vertical-align: top;
          display: inline-block;
          margin-left: 5px;
          margin-top: 5px;
          width: 70px;
          height: 22px;
          line-height: 20px;
          font-size: 12px;
          text-align: center;
          border-radius: 4px;
          &.online {
            background: rgba(71, 113, 220, 0.3);
            color: $base-color;
            border: 1px solid $base-color;
          }
          &.offline {
            background: rgba(252, 112, 62, 0.3);
            color: $base-color-important;
            border: 1px solid $base-color-important;
          }
        }
      }
      .pro {
        margin: 10px 0;
        font-size: 12px;
        color: #ccc;
      }
      .icon-wrap {
        .time,
        .address {
          margin-top: 10px;
          height: 20px;
          line-height: 20px;
          margin-right: 40px;
          i,
          span {
            margin-right: 5px;
            font-size: 14px;
            color: #999;
          }
        }
      }
    }
    .company-data {
      float: left;
      width: 250px;
      margin-top: 30px;
      .data {
        float: left;
        text-align: center;
        padding-left: 50px;
        &:first-child {
          padding-left: 0;
        }
        .num {
          font-size: 28px;
          color: $base-color;
        }
        .text {
          font-size: 12px;
          color: #999;
        }
      }
    }
    .btn-wrap {
      float: right;
      margin-top: 45px;
      button {
        display: inline-block;
        height: 30px;
        line-height: 28px;
        width: 90px;
        border: 1px solid $base-color;
        border-radius: 4px;
        font-size: 16px;
      }
      .detail {
        background: #fff;
        color: $base-color;
        &:hover {
          background: $base-color;
          color: #fff;
        }
      }
      .confirm {
        background: $base-color;
        color: #fff;
        &:hover {
          background: $base-color-hover;
        }
      }
    }
    .state {
      height: 50px;
      line-height: 50px;
      padding-left: 10px;
      margin-top: 10px;
      position: relative;
      border-top: 1px solid #ebebeb;
      &::before {
        content: '';
        height: 16px;
        width: 2px;
        background: $base-color;
        position: absolute;
        left: 0;
        top: 17px;
      }
      p {
        color: $base-color;
      }
    }
  }
}
</style>
